/*
 * Part of knowledge engineering (ke) course work, 2010/11
 */
package se.bth.ke.firstfriend.dto;

import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import se.bth.ke.firstfriend.model.Article;
import se.bth.ke.firstfriend.model.Comment;
import se.bth.ke.firstfriend.model.Topic;
import se.bth.ke.firstfriend.util.Markdown;

/**
 *
 * @author nico.rehwaldt
 * @author markus.goetz
 */
@XmlRootElement
public class ArticleWithHtml {

    @XmlTransient
    private Article article;

    @XmlTransient
    private List<Comment> comments;

    @XmlTransient
    private List<Topic> topics;

    @XmlTransient
    private ArticleUserInfo userInfo;

    @XmlTransient
    private List<Article> dependencies;

    public ArticleWithHtml() {}
    
    public ArticleWithHtml(Article article, List<Comment> comments, List<Topic> topics) {
        this.article = article;
        this.comments = comments;
        this.topics = topics;
    }

    /**
     * @return the article
     */
    public Article getArticle() {
        return article;
    }

    /**
     * @return the comments
     */
    public List<Comment> getComments() {
        return comments;
    }
	
    /**
     * @return the userInfo
     */
    public ArticleUserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(ArticleUserInfo userInfo) {
        this.userInfo = userInfo;
    }
    
    /**
     * @return the topics in which the article appears
     */
	public List<Topic> getTopics() {
        return topics;
    }

    public String getHtml() {
        return Markdown.toHTML(article.getContent());
    }

    /**
     * @param dependency to set
     */
    public void setDependencies(List<Article> dependencies) {
        this.dependencies = dependencies;
    }

    /**
     * @return dependencies of the contained article (if set)
     */
    public List<Article> getDependencies() {
        return this.dependencies;
    }
}
